<include file="Forum:header"/>
<body>
<div class="topic-wrap new-article-wrap add-report">
    <header class="talk-header talk-detail-header"><span class="iconfont go-back"></span>
        <p class="text-center">举报</p>
    </header>
    <div class="add-topic">
        <h4 class="title">选择举报类型</h4>
        <ul class="category-list clearfix">
        	<volist name="data" id="vo" key="k">
            <li data-report_id="{BEESCRM:$vo['report_id']}" class="all <if condition="$k eq 1">current</if>">{BEESCRM:$vo['report_name']}<span class="iconfont"></span></li>
            </volist>
		</ul>
        <textarea placeholder="输入文字" class="content" id="content"></textarea>
        <div class="comment-wrap"><a id="submit-report" href="javascript:void(0);" class="comment-btn">举报</a></div>
    </div>
</div>
<input type="hidden" id="post_id" value="{BEESCRM:$post_id}" >
<input type="hidden" id="user_id" value="{BEESCRM:$user_id}" >
<include file="Forum:commonjs"/>
<script>
    $('.all').click(function(){
    	$(this).addClass('current').siblings().removeClass('current');
    });
    $('.go-back').click(function(){
		history.go(-1);
	});
    
    $('.comment-wrap').click(function(){
    	var report_id = $('.current').data('report_id');
    	var post_id = $('#post_id').val();
    	var reason = $('#content').val();
    	var user_id = $('#user_id').val();
    	if(!reason){
			fm.alert('您还未输入文字内容');return false;
    	}
    	$.ajax({
    		type:'post',
    		url:'{BEESCRM::U('base/forum/doGetReport',array('forum_id' => $forum_id))}',
    		data:{'post_id':post_id,'reason':reason,'user_id':user_id,'report_id':report_id},
    		dataType:'json',
    		success:function(data){
    			if(data.status == 'S'){
					fm.alert(data.message);
    				setTimeout(function(){
    					location.href = data.url;
    				},3000);
    			}else {
					fm.alert(data.message);
    			}
    		},
    		error:function(){
				fm.alert('通讯错误');
    		},
    	});
    });
</script>
</body>
</html>